﻿<r:RibbonWindow x:Class="TicketServer.Client.MainWindow"
				xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
				xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
				xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
				xmlns:c="clr-namespace:TicketServer.Common;assembly=TicketServer.Common"
				xmlns:ctl="clr-namespace:TicketServer.Controls;assembly=TicketServer.Controls"
				xmlns:lex="http://wpflocalizeextension.codeplex.com"
				lex:LocalizeDictionary.DesignCulture="en"
				lex:ResxLocalizationProvider.DefaultAssembly="TicketServer.Client"
				lex:ResxLocalizationProvider.DefaultDictionary="Resources"
				x:Name="RibbonWindow"
				Title="Ticket Client"
				Width="860"
				Height="480"
				WindowStartupLocation="CenterScreen"
				Icon="Icons\Small\vcard.png"
				Loaded="RibbonWindow_Loaded">
	<r:RibbonWindow.Resources>
		<c:TicketToClientStatusColorConverter x:Key="ticketColorConverter" />
	</r:RibbonWindow.Resources>
	
	<Grid x:Name="LayoutRoot">
		<Grid.ColumnDefinitions>
			<ColumnDefinition />
		</Grid.ColumnDefinitions>

		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="*" />
			<RowDefinition Height="25" />
		</Grid.RowDefinitions>

		<r:Ribbon x:Name="Ribbon"
				  Grid.Row="0"
				  Grid.Column="0"
				  Grid.ColumnSpan="3"
				  IsMinimized="True">
			<r:Ribbon.ApplicationMenu>
				<r:RibbonApplicationMenu Label="{lex:LocText File}" SmallImageSource="Icons\Menu.png">
					<r:RibbonApplicationMenuItem x:Name="menuItemSetting"
												 Click="menuItemSetting_Click"
												 Header="{lex:LocText Settings}"
												 ImageSource="Icons\Large\settings.png" />
					<r:RibbonApplicationMenuItem Click="buttonExit_Click"
												 Header="{lex:LocText ExitButton}"
												 ImageSource="Icons\Large\application-exit-2.png" />
				</r:RibbonApplicationMenu>
			</r:Ribbon.ApplicationMenu>
			<r:RibbonTab x:Name="HomeTab" Header="{lex:LocText RibbonTabHome}">
				<r:RibbonGroup Header="{lex:LocText Settings}">
					<r:RibbonButton x:Name="ribbonButtonConnect"
									Label="{lex:LocText Reconnect}"
									LargeImageSource="Icons\Large\reload.png"
									Click="ribbonButtonConnect_Click" />
					<r:RibbonButton x:Name="ribbonButtonSettings"
									Label="{lex:LocText Settings}"
									LargeImageSource="Icons\Large\settings.png"
									Click="menuItemSetting_Click" />
				</r:RibbonGroup>
			</r:RibbonTab>
			<r:RibbonTab Header="{lex:LocText RibbonTabSettings}">
				<r:RibbonGroup Header="{lex:LocText RibbonGroupLanguage}">
					<r:RibbonMenuButton x:Name="ribbonComboBoxLanguage"
										Width="150"
										Label="{lex:LocText RibbonGroupLanguage}">
						<r:RibbonGallery x:Name="ribbonGalleryLanguages"
										 Width="150"
										 MaxColumnCount="1"
										 SelectedValuePath="Content">
							<r:RibbonGalleryCategory x:Name="ribbonGalleryCategoryLanguages" />
						</r:RibbonGallery>
					</r:RibbonMenuButton>
				</r:RibbonGroup>
			</r:RibbonTab>
		</r:Ribbon>

		<Grid x:Name="ticketGrid" Grid.Row="1" Grid.Column="0">
			<Grid.RowDefinitions>
				<RowDefinition Height="32" />
				<RowDefinition Height="42" />
				<RowDefinition />
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition />
				<ColumnDefinition Width="Auto" />
			</Grid.ColumnDefinitions>

			<TextBlock Grid.Row="0"
					   Grid.Column="0"
					   Margin="5"
					   Padding="5 0"
					   HorizontalAlignment="Right"
					   VerticalAlignment="Center"
					   Text="{lex:LocText Ticket}" />
			<TextBox x:Name="textBoxCode"
					 Grid.Row="0"
					 Grid.Column="1"
					 Margin="5"
					 Text=""
					 KeyUp="textBoxCode_KeyUp" />
			<Button x:Name="buttonGetTicket"
					Grid.Row="0"
					Grid.Column="2"
					Margin="5"
					Padding="5 0"
					Click="buttonGetTicket_Click"
					Content="{lex:LocText CheckTicket}" />

			<CheckBox x:Name="checkBoxAutoFocus"
					  Grid.Column="0"
					  Grid.Row="1"
					  Margin="5"
					  VerticalAlignment="Center"
					  Content="{lex:LocText AutoFocus}"
					  Checked="checkBoxAutoFocus_Checked" />
			<TextBlock x:Name="textBlockAutoRedeem"
					   Grid.Row="1"
					   Grid.Column="1"
					   Margin="0"
					   Padding="5 0"
					   FontSize="36"
					   FontWeight="ExtraBold"
					   HorizontalAlignment="Right"
					   VerticalAlignment="Center"/>
			<TextBlock x:Name="textBlockError"
					   Grid.Row="1"
					   Grid.Column="1"
					   Margin="0"
					   Padding="5 0"
					   FontSize="36"
					   Foreground="Red"
					   FontWeight="ExtraBold"
					   HorizontalAlignment="Right"
					   VerticalAlignment="Center"/>
			<Button x:Name="buttonRedeemTicket"
					Grid.Row="1"
					Grid.Column="2"
					Grid.ColumnSpan="1"
					Margin="5 10"
					Click="buttonRedeemTicket_Click"
					Content="{lex:LocText RedeemTicket}"
					IsEnabled="False">
			</Button>

			<ListBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3"
					 x:Name="listBoxStatus"
					 Margin="5"
					 HorizontalContentAlignment="Center"
					 ScrollViewer.CanContentScroll="False">
				<ListBox.ItemTemplate>
					<DataTemplate>
						<StackPanel>
							<ctl:TicketStatus x:Name="statusControl"
											  Margin="5"
											  DataContext="{Binding .}"
											  Ticket="{Binding Ticket, ElementName=., Mode=OneWay}">
								<ctl:TicketStatus.Background>
									<MultiBinding Converter="{StaticResource ResourceKey=ticketColorConverter}">
										<Binding Path="Ticket" />
										<Binding Path="Result" />
									</MultiBinding>
								</ctl:TicketStatus.Background>
							</ctl:TicketStatus>
						</StackPanel>
					</DataTemplate>
				</ListBox.ItemTemplate>
			</ListBox>
		</Grid>
		
		<StatusBar Grid.Row="2"
				   Grid.Column="0"
				   Margin="0 2 0 0"
				   BorderBrush="Gray"
				   BorderThickness="0 1 0 0">
			<StatusBar.ItemsPanel>
				<ItemsPanelTemplate>
					<Grid Margin="0">
						<Grid.RowDefinitions>
							<RowDefinition Height="*" />
						</Grid.RowDefinitions>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="*" />
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="Auto" />
						</Grid.ColumnDefinitions>
					</Grid>
				</ItemsPanelTemplate>
			</StatusBar.ItemsPanel>

			<StatusBarItem>
				<TextBlock x:Name="statusBarItemInfo"
							   Width="Auto"
							   Margin="5 0 5 0"
							   Text="STATUS" />
			</StatusBarItem>
		</StatusBar>
	</Grid>
</r:RibbonWindow>
